home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_09 / barbu2 / descript.hpp < prev    next >
C/C++ Source or Header  |  1996-06-18  |  1KB  |  49 lines

  1. /////////////////////////////////////////////////////
  2. // DESCRIPT, a STR-ing used as a descriptor:
  3. //  <type>['|'<param>=<value>]
  4. /////////////////////////////////////////////////////
  5. #if !defined(DESCRIPT_HPP)
  6. #define DESCRIPT_HPP
  7. #if !defined(RC_INVOKED)    // real C++ stuff
  8. #include "STR.HPP"
  9. class DESCRIPT : public STR {
  10. public:
  11.     DESCRIPT(const char szS[] = 0);
  12.     virtual ~DESCRIPT();
  13.  
  14.     const char* type(STR& Buf) const;
  15.     const char* value(const char szParam[], STR& Buf)
  16.                                 const;
  17.     int value(const char szParam[], int nDefVal = 0)
  18.                                 const;
  19.  
  20.     void setType(const char szType[]);
  21.     void addParam(const char szParam[],
  22.                     const char szValue[]);
  23.     void addParam(const char szParam[], int nValue);
  24.  
  25. private:
  26.     short isSep(int c, int k) const;
  27.     const char* retVal(STR& Buf) const;
  28.     enum { SLASH = '|', EQUAL = '=' , LIT = '\\'};
  29. };
  30.  
  31. class MULTIPARAM {
  32. public:
  33.     MULTIPARAM(const DESCRIPT* Desc,
  34.                 const char szMP[]);
  35.     ~MULTIPARAM() {};
  36.     int no() const { return _n; }
  37.     const char* value(int index, STR& Buf);
  38.     int value(int index, int nDefVal = 0);
  39.  
  40. private:
  41.     const DESCRIPT* const _desc;
  42.     const STR _mp;
  43.     int _n;
  44.     STR _full;
  45.     const char *_makeParam(int index);
  46.     };
  47. #endif
  48. #endif
  49.